package com.douyang.controller;

import com.douyang.VO.FollowedUserInfoVO;
import com.douyang.base.model.Result;
import com.douyang.service.UserFollowedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xiaoma
 * @since 2025-03-05
 */
@RestController
@RequestMapping("/user/userFollowed")
public class UserFollowedController {
    @Autowired
    private UserFollowedService userFollowedService;


    @PostMapping("/followedAuthor")
    public Result<String> followedAuthor(Long authorId) {
        userFollowedService.followedAuthor(authorId);
        return Result.success("ok");
    }

    @GetMapping("/getFollowedUserInfoList")
    public Result<List<FollowedUserInfoVO>> getFollowedUserInfoList() {
        return Result.success(userFollowedService.getFollowedUserInfoList());
    }

    @DeleteMapping("/unFollowed")
    public Result<String> unFollowed(Long userId) {
        userFollowedService.unFollowed(userId);
        return Result.success("ok");
    }
}
